package com.xcc.httpUtils.request;

import com.xcc.httpUtils.utils.StringUtils;
import okhttp3.Request;
import okhttp3.RequestBody;

import java.util.Map;

/**
 * Created by Carman on 2017/7/7.
 * get 请求 Request 参数设置
 */
public class GetRequest extends BaseHttpRequest {

    public GetRequest(String url, Object tag, Map<String, String> params, Map<String, String> headers, String json) {
        super(url, tag, params, headers, json);
    }

    @Override
    protected RequestBody buildRequestBody() {
        if (!StringUtils.isEmpty(mJson)) { // 传入 json 使用 json 请求方式
            return RequestBody.create(JSON_MEDIA, mJson);
        }
        return null;
    }

    @Override
    protected Request buildRequest(RequestBody requestBody) {
        return builder.get().build();
    }
}
